import { CommonEntity } from '../../../../util/entity/common.entity';
import { Column, Entity, ManyToOne } from 'typeorm';
import { User } from '../../../admin/user/entities/user.entity';
import { TransformBigint } from '../../../../util/common-fn';

@Entity('dnf_money')
export class Money extends CommonEntity {
  @Column({
    transformer: new TransformBigint(),
    type: 'bigint',
    comment: '货币数量',
  })
  num: number;
  @Column({ comment: '货币类型' })
  priceType: number;

  @ManyToOne(() => User, (user) => user.moneys)
  user: User;

  constructor(priceType: number, num: number) {
    super();
    this.num = num;
    this.priceType = priceType;
  }
}
